<template>
    <div class="foot">
        <div class="content">
            <div class="iconfont icon-shoucang"></div>
            <div class="text">收藏</div>
        </div>
        <div class="content" @click="SendDataToBar(contentone,contenttwo)">
            <div class="iconfont icon-gouwuche"></div>
            <div class="text">加购</div>
        </div>
        <div v-if="flag"  class="null">加购成功</div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            flag:false
        };
    },
    props:{
        contentone:null,
        contenttwo:null
    },
    methods:{
        SendDataToBar(dataone,datatwo){
            let a = dataone.tradeItemId
            let b = {
                "img":dataone.img,
                "title":dataone.title,
                "price":dataone.price,
                "orgPrice":dataone.orgPrice,
            } 
            let c = localStorage.getItem("cart");
            let e =  JSON.stringify(b)
            if(c){
                let j = c + "~" +e
                localStorage.setItem("cart",j)
            }else{
                localStorage.setItem("cart",e)
            }
            this.flag=true
            setTimeout(()=>{
                // this.$router.push({name:"ShopCar"})
                this.flag=false
            },2000)
        }
    },
    components: {}
};
</script>

<style lang='less' scoped>
.foot {
    position: fixed;
    width: 100%;
    bottom: 0px;
    display: flex;
    justify-content: space-around;
    border-top: 1px solid #ccc;
    padding-top:10px;
    .content {
        width: 373px;
        height: 90px;
        font-size: 24px;/*px*/
        display: flex;
        flex-flow: column;
        align-items: flex-end;
        border-right:1px solid #ccc;
        .iconfont {
            font-size: 50px;/*px*/
            width: 373px;
            height: 50px;
            line-height: 50px;
            text-align: center;
        }
        .text {
            width: 373px;
            height: 40px;
            text-align: center;
            line-height: 40px;
        }
        
    }
    .null{
        position: absolute;
        left:42%;
        top:35px;
        color:crimson;
        border:1px solid crimson;
    }
}
</style>
